package com.smallkk.user.controller;

import com.smallkk.user.entity.User;
import com.smallkk.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created By  醉美柳舞之众星捧月
 *
 * @author song
 * @date 2018/1/2 15:35
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * Author song  醉美柳舞之众星捧月
     * Date & Time  2018/1/2 15:46
     * Description   请求转发
     */
    @RequestMapping("/login")
    public String login() {
        System.out.println("Debug wait ****** ");
        return "login";
    }

    /**
     * Author song  醉美柳舞之众星捧月
     * Date & Time  2018/1/2 15:53
     * Description   数据控制
     */
    @RequestMapping("insert")
    public String insert() {
        //链接到业务层
        User user = userService.addUser();
        System.out.println("数据库插入数据成功!");
        return "successful";
    }
}
